class TaobaoStore:
    id = 0
    def __init__(self):
        self.product_list = []

    def add_product(self, name, sku, price):
        TaobaoStore.id +=1

        product = {'id': TaobaoStore.id, 'name': name, 'sku': sku, 'price': price, 'status': '上架'}
        self.product_list.append(product)
        print(f'商品 {name} 添加成功！')

    def modify_product(self, sku, new_name=None, new_price=None):
        for product in self.product_list:
            if product['sku'] == sku:
                if new_name:
                    product['name'] = new_name
                if new_price:
                    product['price'] = new_price
                    print(f'商品 {sku} 信息修改成功！')
                    return
            print(f'找不到SKU为 {sku} 的商品！')

    def take_off_product(self,id,name):
        for product in self.product_list:
            if product['name'] == name:
                if product['id'] == id:

                    product['status'] = '下架'
                    print(f'商品 {name} 已下架！')
                    return
                print(f'找不到名称为 {name} 的商品！')

    def display_products(self):
        print("商品列表:")
        for product in self.product_list:
            print(f"商品id：{product['id']}，名称: {product['name']}, SKU: {product['sku']}, 价格: {product['price']}, 状态: {product['status']}")


taobao_store = TaobaoStore()

taobao_store.add_product('手机', '黑色', 1999.99)
taobao_store.add_product('手机', '', 4999.99)
taobao_store.add_product('耳机', 'SKU003', 199.99)

taobao_store.display_products()

taobao_store.modify_product('SKU001',  new_price=2299.99)
taobao_store.take_off_product(1,'手机')

taobao_store.display_products()
